//
//  WGQAttendanceRecordsTableViewCell.m
//  meiang_edu
//
//  Created by gq w on 2018/9/27.
//  Copyright © 2018年 com.meiang.meiang_edu. All rights reserved.
//

#import "WGQAttendanceRecordsTableViewCell.h"
#import "SKConstant.h"

@interface WGQAttendanceRecordsTableViewCell ()

@property (nonatomic, strong) SKCalendarView * calendarView;
@property (nonatomic, assign) NSUInteger lastMonth;
@property (nonatomic, assign) NSUInteger nextMonth;

@end

@implementation WGQAttendanceRecordsTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        [self addSubViews];
        self.contentView.backgroundColor = FFColor(0xEBEBEB);
    }
    return self;
}

- (void)addSubViews
{
    //添加日历视图
    if (!_calendarView)
    {
        _calendarView = [[SKCalendarView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth - 8 * kScale, kScreenWidth - 8 * kScale)];
        _calendarView.backgroundColor = [UIColor whiteColor];
        _calendarView.layer.masksToBounds = YES;
        _calendarView.layer.cornerRadius = 7 * kScale;
        _calendarView.calendarTodayTitleColor = [UIColor redColor];// 今天标题字体颜色
        _calendarView.calendarTodayTitle = @"今日";// 今天下标题
        _calendarView.dayoffInWeekColor = FFColor(0x666666);
        _calendarView.springColor = FFColor(0x999999);// 春季节气颜色
        _calendarView.summerColor = FFColor(0x999999);// 夏季节气颜色
        _calendarView.autumnColor = FFColor(0x999999);// 秋季节气颜色
        _calendarView.winterColor = FFColor(0x999999);// 冬季节气颜色
        _calendarView.holidayColor = FFColor(0x999999);//节日字体颜色
        self.lastMonth = _calendarView.lastMonth;// 获取上个月的月份
        self.nextMonth = _calendarView.nextMonth;// 获取下个月的月份
        [self.contentView addSubview:self.calendarView];
        
        __weak __typeof(&*self)weakSelf = self;
        _calendarView.data_count_block = ^(NSDictionary *dict)
        {
            if (weakSelf.data_cout_block)
            {
                weakSelf.data_cout_block(dict);
            }
        };
    }
}

- (void)jumpLastMonth
{
    //跳转上个月
    self.calendarView.checkLastMonth = YES;// 查看上月
}

- (void)jumpNextMonth
{
    //跳转下个月
    self.calendarView.checkNextMonth = YES;// 查看下月
}

//更新当前的宝宝和机构的信息
- (void)updataBabayModel:(WGQTransfersRecordsBabyModel *)model institutionsId:(NSString *)institutions_id
{
    [_calendarView updataBabayModel:model institutionsId:institutions_id];
}

- (void)awakeFromNib
{
    [super awakeFromNib];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];
}

@end
